import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";

class ListItem extends StatefulWidget {
  final GestureTapCallback? onTap;
  const ListItem({super.key, this.onTap});

  @override
  State<StatefulWidget> createState() => _ListItemState();

}

class _ListItemState extends State<ListItem> {
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: () {
        if (widget.onTap != null) widget.onTap!();
      },
      child: Container(
        padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 12),
        decoration: const BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(5)),
          color: Colors.white,
        ),
        child: const Row(
          children: [
            DecoratedBox(
              decoration: BoxDecoration(
                color: ThemeVars.colorBackground,
                borderRadius: BorderRadius.all(Radius.circular(50)),
              ),
              child: Icon(Icons.person, size: 50,),
            ),
            SizedBox(width: 10,),
            Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text("黄天下"),
                    SizedBox(height: 4,),
                    Row(
                      children: [
                        Text("2023.02.25 21:32", style: TextStyle(color: ThemeVars.colorTextTer, fontSize: 13),),
                        SizedBox(width: 10,),
                        Text("永久", style: TextStyle(color: ThemeVars.colorTextTer, fontSize: 13),),
                      ],
                    )
                  ],
                )
            )
          ],
        ),
      ),
    );
  }

}